#!/usr/bin/perl
# trapadd.cgi

require 'snmp-lib.pl';

&header($text{'trapadd_title'}, "", "trapadd", undef, 1);
#print "<hr>";

##get the comm list
my $fileContent = &ReadConfFile();
my @commlist=();
for(my $i=0; $i < @$fileContent; $i++)
{
	my $entry = $fileContent->[$i];
	if($entry =~ /^r[wo]community (\w+)/)
	{
		push(@commlist, $1);
	}

}

#add trap receiver
print "<form name=add method=post action=addtrap.cgi>";
print "<p><BR>$text{'host_name'} <input class=text type=text name=hostName size=20></p>";
print "<p><BR>$text{'comm_name'}:  ";
print "<select name=commName size=1>";
for my $i (@commlist)
{
	print "<option value=$i>$i</option>";
}
print	"</select></p>";

print "<p><input class=button1 type=submit value=$text{'submit'}></p>";
print "</form>";

#print "<hr>";
&footer("/ucd-snmp/",$text{'index_title'});
